﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using IDML.BusinessObject;
using IDML.BusinessLogic;

namespace IDML.Web.Modules.Patient
{
    public partial class RegisterPatient : System.Web.UI.Page
    {

        protected void Page_Load(object sender, EventArgs e)
        {
            
        }

        protected void btnRegister_Click(object sender, EventArgs e)
        {
            IDMLSession idmlSession = new IDMLSession();
            PatientBO patientBO;
            PatientBL patientBL;

            try
            {
                patientBO = new PatientBO();
                patientBL = new PatientBL();

                patientBO.TitleID = Convert.ToInt32(ddlTitle.SelectedValue);
                patientBO.FirstName = txtFirstName.Text.ToString();
                patientBO.LastName = txtLastName.Text.ToString();
                patientBO.PhoneNumber = txtPhone.Text.ToString();
                patientBO.Age = Convert.ToInt32(txtAge.Text);
                patientBO.Gender = Convert.ToByte(ddlGender.SelectedValue);
                patientBO.IUserID = Convert.ToInt32(idmlSession.User.UserID);

                int patID = patientBL.Patient_Register(patientBO);
               
                Response.Redirect("View.aspx?PATID=" + patID);
               
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }


    }
}